import { Row, Col, Icon, Modal,Spin, Button } from 'antd';
import { routerShape } from 'react-router';
import includes from 'lodash/includes';
import isEqual from 'lodash/isEqual';
import {getLogAllReceiveUser} from '../../apis/api';
import { observable} from 'mobx'
import './style/logItem.less'
import * as secondAuthTypes from "../../constants/secondAuthType";
import { WeaLocaleProvider, WeaDialog, WeaMap ,WeaAudio, WeaAvatar} from 'ecCom';
import { getLocationInfoData } from '../../util/signUtil';
import  ReplyDialog from './ReplyDialog';
import ContentList from './ContentList';
import { toJS } from 'mobx';
const getLabel = WeaLocaleProvider.getLabel;

export default class SignListItem extends React.Component {
    static contextTypes = {
        router: routerShape
    }

    constructor(props) {
        super(props);
        this.state = {
            showrivebtnspan: false,
            showSecondAuth : false,
            allReceiveUser:'',
            showUsers:false,
            loading:false,
            edit: false,
            communicateSettingKey: this.getCommunicateSettingKey(props),
            isBlackColor:window.WfForm.getGlobalStore().commonParam.isprint == 1 && window.WfForm.getLayoutStore().propFileCfg.print_signList_black_color == 1,
        }
    }

    getCommunicateSettingKey(props){
        let communicateSettingKey = {};
        let isMainReqeuestid = true;
        const isOpenCommunication = props.isOpenCommunication || '0';
        const isShowSignCommunicate = props.logListStore.communicateSettingKey.isShowSignCommunicate || '0';
        const isExpendCommunicate = props.logListStore.communicateSettingKey.isExpendCommunicate || '0';
        const  hasSubmitRight = props.logListStore.hasSubmitRight;
        const refRequestid = props.logListStore.refRequestId;
        const allrequestInfos = props.logListStore.requestLogParams.allrequestInfos;
        for(let index in allrequestInfos){
            if(allrequestInfos[index].requestid == refRequestid){
                communicateSettingKey.isOpenCommunication = allrequestInfos[index].isOpenCommunication;
                communicateSettingKey.isShowSignCommunicate = allrequestInfos[index].isShowSignCommunicate;
                communicateSettingKey.isExpendCommunicate = allrequestInfos[index].isExpendCommunicate ;
                communicateSettingKey.hasSubmitRight = allrequestInfos[index].hasSubmitRight;
                isMainReqeuestid = false ;
                break;
            }
        }
        if(isMainReqeuestid){
            if(isOpenCommunication == '1'){
                communicateSettingKey.isOpenCommunication = true;
            }
            if(isShowSignCommunicate == '1'){
                communicateSettingKey.isShowSignCommunicate = true;
            }
            if(isExpendCommunicate == '1'){
                communicateSettingKey.isExpendCommunicate = true;
            }
            communicateSettingKey.hasSubmitRight = hasSubmitRight;
        }
        return communicateSettingKey;
    }

    componentWillReceiveProps(nextProps){
        if(this.props.data['logid'] != nextProps.data['logid']) {
            this.setState({
                showrivebtnspan: false,
                showSecondAuth : false,
                allReceiveUser:'',
                showUsers:false,
                loading:false,
                communicateSettingKey: this.getCommunicateSettingKey(this.props)
            });
        }
    }
    
   
    render() {

        const { data = {}, isShowUserheadimg, forward, forwardEvent, requestid, workflowid, authSignatureStr, authStr, controllShowAllLogOperator, secondAuthStore,isprint,
        } = this.props;
        const { logListStore } = this.props;
        const {
            logid, displaydepid = '', img_path = '', isexsAgent, log_agentorbyagentid = '', displaybyagentname = '', displayid,displaytype, displayname = '',
            displaydepname, log_remarkHtml = '', annexdocs = [], signdocs = [], signwfs = [], userimg = '',signnaturImgHeight, remarkLocation,speechAttachmetnDatas = [],
            commentList=[]
        } = data;
        const { receiveUser = '', receiveUserCount = 0, log_operatedate, log_operatetime, log_nodename, operationname, isReference} = data;
        const { showrivebtnspan ,showUsers,allReceiveUser = '',loading, communicateSettingKey:{isOpenCommunication,isShowSignCommunicate,isExpendCommunicate,hasSubmitRight}, edit , isBlackColor} = this.state;
        const {checkResult, isProtected, protectTypes} = secondAuthStore;
        let locationInfoData = getLocationInfoData(remarkLocation);
        let checkClassName = "";
        if (isProtected.has(logid)) {
            const isProtected0 = isProtected.get(logid);
            const protectType = protectTypes.get(logid) || 0;
            if (isProtected0 == 1) {
                if(protectType == secondAuthTypes.CA_AUTH){     //CA认证
                    checkClassName += "content-right-ca-auth";
                }else if(protectType == secondAuthTypes.QYS){     //契约锁
                    checkClassName += "content-right-qys-auth";
                }

            }
            if (checkResult.has(logid)) {
                const checkResult0 = checkResult.get(logid);
                if (checkResult0 == 1) {
                    if (protectType == secondAuthTypes.CA_AUTH) {
                        checkClassName += " content-right-ca-auth-success";
                    } else if (protectType == secondAuthTypes.QYS) {
                        checkClassName += " content-right-qys-auth-success";
                    }
                } else if (checkResult0 == 0) {
                    if (protectType == secondAuthTypes.CA_AUTH) {
                        checkClassName += " content-right-ca-auth-failed";
                    } else if (protectType == secondAuthTypes.QYS) {
                        checkClassName += " content-right-qys-auth-failed";
                    }
                }
            }
        }
      
        const dpurl = `/spa/hrm/engine.html#/hrmengine/organization?showTree=false&isView=1&type=department&id=${displaydepid}&_key=3b4uab`;
        return (
            <div className={`wf-req-sign-list-content${isBlackColor ? ' wf-req-sign-blackColor' : ''}`}>
                <div className='content-left' style={{ 'paddingLeft': isShowUserheadimg ? '48px' : '0px' }}>
                    {isShowUserheadimg && displaytype == '0' &&
                        <WeaAvatar ecId={`${this && this.props && this.props.ecId || ''}_WeaAvatar@ne9btc`} userId={displayid}/>
                    }
                    {isShowUserheadimg && displaytype == '1' &&
                        <img src={img_path} className='content-text-left-user-img' />
                    }
                    <div style={{ 'width': '132px' }}>
                        <p>
                            {isexsAgent && <a href={`javaScript:openhrm(${log_agentorbyagentid})`}
                                onClick={event => window.pointerXY(event)}>{displaybyagentname}</a>}
                            {isexsAgent && <span style={{ color: "#2db7f5" }}>{`->`}</span>}
                            { displaytype==0 ? <a href={`javaScript:openhrm(${displayid})`}
                                onClick={event => window.pointerXY(event)}>{displayname}</a> :
                                <a target={`_blank`}  href={`/spa/crm/static/index.html#/main/crm/customerView?customerId=${displayid}`} >{displayname}</a>}
                        </p>
                        <span className={'left-department-span'}>
                            <a href={dpurl} target="_blank" style={{ color: '#9b9b9b', 'white-space': 'pre-wrap' }}>
                                {displaydepname}
                            </a>
                        </span>
                    </div>
                </div>
                <div 
                  className='content-right'
                  onMouseEnter={() => this.setState({ showrivebtnspan: true })}
                  onMouseLeave={() => this.setState({ showrivebtnspan: false })}>
                    <div className='content-right-remark-html' dangerouslySetInnerHTML={{ __html: log_remarkHtml }} />
                    {
                        speechAttachmetnDatas 
                        && speechAttachmetnDatas.map((r,audioIndex) => {
                            return (
                                <WeaAudio ecId={`${this && this.props && this.props.ecId || ''}_WeaAudio@3hruvq@${audioIndex}`} id={`audio_${logid}_${audioIndex}`} onRef={(e) => {}} src = {r} />
                            )
                        })
                    }
                    {annexdocs.length > 0 && <div className='content-right-docs'>
                        <i className='icon-mail-enclosure' />
                        <div>
                            {annexdocs.map((d = {}) => {
                                const { filelink = '', tempshowname = '', fileExtendName = '', downloadlink = '', docImagefileSize, showdownload } = d;
                                return (
                                <p>
                                  <a target='_blank' href={filelink}>
                                      {`${tempshowname}.${fileExtendName}`}
                                  </a>
                                      {' '}
                                      {
                                        showdownload == true 
                                        && <a onClick={() => { this.download(`${downloadlink}&_t=${new Date().getTime()}`) }}>
                                          {`[${getLabel('31156', "下载")}(${(docImagefileSize / 1000).toFixed(1)}k)]`}
                                        </a>
                                      }
                                    </p>
                                )
                            })}
                        </div>
                    </div>
                    }
                    {signdocs.length > 0 && <div className='content-right-docs'>
                        <i className='icon-search-File' />
                        <div>
                            {signdocs.map((d = {}) => {
                                return <p><a target='_blank' href={d['filelink']}>{d['tempshowname']}</a></p>
                            })}
                        </div>
                    </div>
                    }
                    {signwfs.length > 0 && <div className='content-right-docs'>
                        <i className='icon-coms-workflow' />
                        <div>
                            {signwfs.map((w = {}) => {
                                return (
                                <p>
                                  <a
                                    target='_blank' 
                                    onClick={() => {
                                      openFullWindowHaveBar(`/workflow/request/ViewRequestForwardSPA.jsp?requestid=${w['requestid']}&isrequest=1&isovertime=0&desrequestid=${w['desrequestid']}&authStr=${authStr}&authSignatureStr=${authSignatureStr}&f_weaver_belongto_userid=${w['f_weaver_belongto_userid']}&f_weaver_belongto_usertype=${w['f_weaver_belongto_usertype']}`)
                                  }}>
                                    {w['title']}
                                  </a>
                                </p>
                              ) 
                            })}
                        </div>
                    </div>
                    }
                    {
                      (remarkLocation !== 'null')  
                      && (locationInfoData.longitude) 
                      && <div className='content-right-docs'>
                            <i className="icon-coms-position" title={getLabel(22981, "位置")} />
                            <div>
                              <a onClick={() => {window.openlocation(remarkLocation, jQuery('#container')[0])}}>{locationInfoData.name}</a>
                            </div>
                      </div>
                    }
                    {
                      /*  注释掉，使用getUserImg统一处理数据保护和个人签名的标识
                      userimg &&
                        <div className="content-right-userimg">
                            <img style={{'maxHeight':`${signnaturImgHeight}px`}} id="markImg" src={userimg}></img>
                        </div>*/
                    }

                    {
                        this.getUserImg(data)
                    }
                    
                   
                    {!showUsers &&
                        <p className={'logitem-Recipient'}>
                            <span>{getLabel('15525', "接收人")} : </span>
                            {receiveUser.replace(/,/g, ' ')}
                            {loading && <Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@0pr8d9`} size={"small"}/>}
                            {!loading && receiveUserCount > 20 && <Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@g8aqlg`} className='content-text-right-open-btn' type='down'
                                    onClick={() => this.controllShowAllLogOperator(logid)} />
                            }
                        </p>
                    }
                    {showUsers &&
                        <div className='wf-req-sign-list-users'>
                            <div style={{ color: '#323232', paddingRight: 20 }}>
                                <span style={{ color: '#c0c0c0' }}>{getLabel('15525', "接收人")} : </span>
                                {allReceiveUser.replace(/,/g, ' ')}
                            </div>
                            {<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@o8u5sx`} className='content-text-right-open-btn' type='up'
                                onClick={() => this.controllShowAllLogOperator(logid)} />}
                        </div>
                    }
                    <p className={'loglist-item-operatedate'} >
                        <span style={{ marginRight: 8 }}>
                          {`${log_operatedate} ${log_operatetime} `}
                        </span>
                        <span>
                          {`[${log_nodename} / ${operationname}]`}
                        </span>
                        {showrivebtnspan
                        && <span style={{ float: 'right' }} className="reqlogbtn">
                              <span style={{ marginRight : 16, cursor: 'pointer '}}>
                                { 
                                  isprint != 1
                                  && isOpenCommunication
                                  && hasSubmitRight
                                  && <span onClick={this.replyClick.bind(this, data)}>
                                        <i className='icon-coms-message-o'
                                          style={{ marginRight: 6 }}
                                        />
                                          {getLabel(385534, "回复")}
                                     </span>
                                  }
                                </span>
                                <span style={{ marginRight: 16, cursor: 'pointer' }}>
                                  {
                                    isReference 
                                    &&  isprint != 1 
                                    && <span onClick={this.quoteClick.bind(this, data)}>
                                          <i className='icon-xxx-form-Quote' style={{ marginRight: 6 }} />
                                          {getLabel('19422', "引用")}
                                        </span>
                                  }
                                  </span>
                                <span style={{ cursor: 'pointer' }}>
                                  {
                                    forward == '1' 
                                    &&  isprint != 1 
                                    && <span onClick={() => typeof forwardEvent === 'function' && forwardEvent(displayid)}>
                                          <i className='icon-xxx-form-Forward' style={{ marginRight: 6 }} />
                                          {getLabel('6011', "转发")}
                                      </span>
                                    }
                                </span>
                            </span>
                        }
                    </p>
                </div>
                {/* 回复逻辑代码 */}
                {
                  isShowSignCommunicate
                  && Array.isArray(toJS(commentList))
                  && toJS(commentList).length > 0 
                  && <div className='communication-area-wrap'>
                      {
                        (!isExpendCommunicate)
                        ? <div className='communication-folder-panel' onClick={() => {this.clickCheckCommunication()}}>
                                <span className='word-span' title={getLabel(519614, '展开交流')}> 
                                  {getLabel( '519614', '展开交流')}
                                </span>
                              <i className="icon-coms-down-001" />
                          </div>
                        : [
                          <div 
                            className={!isExpendCommunicate ? 'communication-folder-panel open': 'communication-folder-panel'}
                            onClick={() => {this.clickCheckCommunication()}}
                          >
                              <span className='word-span' title={getLabel(519615, '收起交流')}>
                                {getLabel('519615', '收起交流')}
                              </span>
                              <i className="icon-coms-up-001" />
                          </div>
                          , <ContentList 
                              ecId={`${this && this.props && this.props.ecId || ''}_ContentList@agoqmj@${logid}`} 
                              logid={logid} 
                              commentList={toJS(commentList)} 
                              logListStore={logListStore}
                              isprint={isprint}
                              hasSubmitRight={hasSubmitRight}
                            />
                        ]
                      }
                    </div>
              }
            </div>
        )
    }
   
    getReplyDialog = (data, replyRemarkStr) => {
      const {
        setTabKey,
        logListStore,
        logListStore:{isSubReqeuestid}
       } = this.props;
       const {communicateSettingKey:{isShowSignCommunicate}} = this.state;
       let com = null; 
       let replyDialog = document.getElementById('reply-dialog-warp');
       let submitCallBackFun = () => {
          if(isSubReqeuestid() != 0 ) return // 处理主子流程问题
          setTabKey('communication'); //点击回复直接跳转至相关交流页面
          window.reflashCommunicateContentList && window.reflashCommunicateContentList();
      }
      if(!replyDialog) {
        replyDialog = document.createElement('div');
        replyDialog.setAttribute('id', 'reply-dialog-warp');
        document.body.appendChild(replyDialog);
      } 
      if(isShowSignCommunicate) {
        com = <ReplyDialog ecId={`${this && this.props && this.props.ecId || ''}_ReplyDialog@gyxu94`} replyInfo={data} replyRemarkStr={replyRemarkStr} store={logListStore}/>
      } else {
        com = <ReplyDialog ecId={`${this && this.props && this.props.ecId || ''}_ReplyDialog@quagrp`} replyInfo={data} replyRemarkStr={replyRemarkStr} store={logListStore} submitCallBackFun={submitCallBackFun}/>
      }
      
      ReactDOM.render(com, replyDialog);
    }
    clickCheckCommunication = () => {
        const { communicateSettingKey:{hasSubmitRight,isOpenCommunication,isShowSignCommunicate,isExpendCommunicate} } = this.state;
        if(isExpendCommunicate) {
            this.setState({communicateSettingKey:{hasSubmitRight:hasSubmitRight,isOpenCommunication:isOpenCommunication,isShowSignCommunicate:isShowSignCommunicate,isExpendCommunicate:false}});
        } else {
            this.setState({communicateSettingKey:{hasSubmitRight:hasSubmitRight,isOpenCommunication:isOpenCommunication,isShowSignCommunicate:isShowSignCommunicate,isExpendCommunicate:true}});
        }
    }
    replyClick(data) {
      const contentDiv = jQuery(".wea-new-top-req-content");
      contentDiv.css("overflow-y", "auto");
      let str = data.log_remarkHtml;
      let remarkStr =  '<div class="wrap_box">'+ str +'</div>';
      let remarkElement = $(remarkStr);
      remarkElement.children().filter(".container_form_wrap") 
        && remarkElement.children().filter(".container_form_wrap").remove();
      remarkElement.children().filter("span:not(#wea_rich_text_default_font)") 
        && remarkElement.children().filter('span:not(#wea_rich_text_default_font)').remove();
      let newStr = remarkElement.html(); //还原成字符串
      str = this.imgUtil(newStr);
      this.getReplyDialog(data, str);
    }

    quoteClick(data = {}) {//点击引用不控制编辑器的显隐

        let { isexsAgent, displaybyagentname, displayname, displaydepname, log_operatedate, log_operatetime, log_remarkHtml = '', remarkLocation='' } = data;
        const { controlVariableMap, variableMap } = this.props;
        typeof controlVariableMap === 'function' && controlVariableMap('isShowSignInput', true);

        if ($("table #remark_div") && $("#remark_div").offset().top !== 0) {
            $(".wea-new-top-req-content").scrollTop($(".excelTempDiv").height() - $("#remark_div").height() - 70)
        } else if ($("#remark_div").offset().top !== 0) {
            $(".wea-new-top-req-content").scrollTop($("#remark").height())
        }

        let title = getLabel('19422', "引用");
        if (isexsAgent) {
            title += `<font style="margin:0 10px;color:#4D7AD8" >${displaybyagentname}->${displayname}</font>`;
        } else {
            title += `<font style="margin:0 10px;color:#4D7AD8">${displayname}</font>`;
        }
        title += `${displaydepname}  ${log_operatedate} ${log_operatetime}`;
        log_remarkHtml = log_remarkHtml.replace(/<span style='font-size:11px;color:#666;'>/g,"<span style='font-size:11px;color:#666;' _quote='true'>");
        
        let locationInfoData = remarkLocation && getLocationInfoData(remarkLocation); 

        let container__ = `<div class='container_form_wrap' style="color:#333">` +
              `<span class='container_form_wrap_span'>${title}</span>` +
              `<div _quotoContent='true' style='color:#333;line-height:normal'>${this.imgUtil(log_remarkHtml)}</div>
              </div>`;
        let remarkMap = observable.map ? observable.map({}) : asMap({});
        if (variableMap.has("remark_list")) {
            remarkMap = variableMap.get('remark_list');
        }
        let index = 0;
        if (variableMap.has("remark_list_index")) {
            index = variableMap.get('remark_list_index')
        }
        let flag = true; //不重复
        remarkMap.forEach((value, key, map) => {
            if (value === container__) {
                Modal.warning({
                    title: '提示信息',
                    content: '不能重复引用',
                });
                flag = false;
            }
        })
        if (flag) {
            remarkMap.set(`key_${index}`, container__);
            controlVariableMap('remark_list_index', index + 1);
            typeof controlVariableMap === 'function' && controlVariableMap('remark_list', remarkMap);
        }
        //let __remark = WfForm.getReqState().getIn(["params", "markInfo", "remarkInfo","remark"]);
        //actions.updateRemarkInfo({remark:`${__remark}${container__}<p><br></p>`});


        // let ckeditor = window.CK_REF.remark;
        // if (ckeditor) {
        //     setTimeout(function () {
        //         ckeditor.insertHTML(`${container__}<p><br></p>`, 'last');
        //     },100);
        // }


    }

    controllShowAllLogOperator(logid){
        let {showUsers = false,allReceiveUser = '',loading = false} = this.state;
        if(!showUsers && allReceiveUser == '' && !loading) {
            this.setState({loading:true});
            getLogAllReceiveUser({logid}).then(data=>{
                this.setState({loading:false,showUsers:true,allReceiveUser:data.receivedPersons});
            })
        } else {
            this.setState({showUsers:!showUsers});
        }
    }


    imgUtil(srcHtml__) {
        //懒加载图片需要处理
        let swapObj = jQuery(`<div>${srcHtml__}</div>`);
        swapObj.find("img").each(function(){
            const imgObj = jQuery(this);
            if(imgObj.attr("original-src"))
                imgObj.removeAttr("src").attr("src", imgObj.attr("original-src")).removeAttr("original-src");
            if(imgObj.attr("original-style"))
                imgObj.removeAttr("style").attr("style", imgObj.attr("original-style")).removeAttr("original-style");
            else
                imgObj.removeAttr("style");
        });
        let swapHtml = swapObj.html();
        swapHtml = swapHtml.replace(/<img(.*?)(\/)?>(<\/img>)?/ig,"<img$1/>");
        return swapHtml;
    }

    download(url) {
        jQuery('#WfFormFileDownload').attr('src', url);
    }

    checkAuthDetail(logid,clickCheck) {
        const {secondAuthStore, showAuthDetail,isprint = 0} = this.props;
        if(isprint != 1) {
            secondAuthStore.setLogId(logid);
            if (clickCheck == 1) {       //最新的一条签字意见需要点击再验证
                secondAuthStore.checkProtectDatas().then(data => {
                    const {success, message} = data;

                    if (logid > 0) {
                        //success:0验证出错，1：未被篡改，2：被篡改
                        if (success == "1") {
                            secondAuthStore.setCheckResult(logid, 1);
                        } else if (success == "2") {
                            secondAuthStore.setCheckResult(logid, 0);
                        }

                        showAuthDetail(logid);

                        const {showSecondAuth} = this.state;
                        this.setState({showSecondAuth: !showSecondAuth});
                    }
                });
            } else {  //直接显示被保护的数据
                showAuthDetail(logid);
                const {showSecondAuth} = this.state;
                this.setState({showSecondAuth: !showSecondAuth});
            }
        }
    }

    getUserImg(itemData) {
        const {logid, qys_signature_id = "", userimg, signnaturImgHeight,clickCheck = 0,qyswidth = 0,qysheight = 0} = itemData;
        const {secondAuthStore} = this.props;
        const {checkResult, isProtected, protectTypes} = secondAuthStore;let imgstyle = {};
        if( qyswidth> 0 && qysheight > 0){
            imgstyle.width = qyswidth;
            imgstyle.height = qysheight;
        }
        let checkClassName = "";
        const maxHeightStyle= signnaturImgHeight == -1 ? 'none' : signnaturImgHeight+'px';
        if (isProtected.has(logid)) {
            const isProtected0 = isProtected.get(logid);
            const protectType = protectTypes.get(logid) || 0;
            if (isProtected0 == 1) {
                if (protectType == secondAuthTypes.CA_AUTH) {     //CA认证
                    checkClassName += "content-right-ca-auth";
                } else if (protectType == secondAuthTypes.QYS) {     //契约锁
                    if(!!qys_signature_id || userimg){
                        checkClassName += "content-right-qys-signature";
                    }else {
                        checkClassName += "content-right-qys-auth";
                    }
                }
            }

            if (checkResult.has(logid)) {
                const checkResult0 = checkResult.get(logid);
                if (checkResult0 == 1) {
                    if (protectType == secondAuthTypes.CA_AUTH) {
                        checkClassName += " content-right-ca-auth-success";
                    } else if (protectType == secondAuthTypes.QYS) {
                        if (!!qys_signature_id  || userimg) {
                            checkClassName += " content-right-qys-signature-success";
                        } else {
                            checkClassName += " content-right-qys-auth-success";
                        }
                    }
                } else if (checkResult0 == 0) {
                    if (protectType == secondAuthTypes.CA_AUTH) {
                        checkClassName += " content-right-ca-auth-failed";
                    } else if (protectType == secondAuthTypes.QYS) {
                        if (!!qys_signature_id  || userimg) {
                            checkClassName += " content-right-qys-signature-failed";
                        } else {
                            checkClassName += " content-right-qys-auth-failed";
                        }
                    }
                }
            }

            if (isProtected0 == 1) {        //有数据保护
                if (protectType == secondAuthTypes.QYS) {
                    if (!!qys_signature_id ) {       //有契约锁的个人签名
                        return (
                            <div className={checkClassName} onClick={this.checkAuthDetail.bind(this, logid, clickCheck)}>
                                <img src={`/weaver/weaver.file.FileDownload?fileid=${qys_signature_id}`} {...imgstyle}/>
                                <div/>
                            </div>
                        );
                    } else if (userimg) {      //使用个人签章
                        return (
                            <div className="content-right-userimg" style={{'maxHeight': `${maxHeightStyle}`}}>
                                <img style={{'maxHeight': `${maxHeightStyle}`, "cursor": "pointer"}} src={userimg} onClick={this.checkAuthDetail.bind(this, logid, clickCheck)}/>
                                <div/>
                            </div>
                        );
                    }
                }

                //没有签章用默认的样式
                return <div className={checkClassName} onClick={this.checkAuthDetail.bind(this, logid,clickCheck)}/>
            }else {     //没有数据保护
                if (!!qys_signature_id) {       //说明有契约锁认证
                    return (
                        <div className="content-right-userimg">
                            <img style={{"cursor": "pointer"}} src={`/weaver/weaver.file.FileDownload?fileid=${qys_signature_id}`}   {...imgstyle} onClick={this.checkAuthDetail.bind(this, logid, 0)}/>
                        </div>
                    );
                }
            }
        }

        if (userimg) {
            return (
                <div className="content-right-userimg">
                    <img style={{'maxHeight': `${maxHeightStyle}`}} id="markImg" src={userimg}></img>
                </div>
            );
        } else {
            return null;
        }
    }
}
